console.time('push for顺序')
let arr1 = []
for (let index = 0; index < 1000; index++) {
  arr1.push({ a: index })
}
console.timeEnd('push for顺序')

console.time('concat方法拼接数组')
const arr2 = [].concat(arr1)
console.timeEnd('concat方法拼接数组')

console.time('push for倒序')
const arr3 = []
for (let index = 0; index < 1000; index++) {
  arr3.push({ a: index })
}
console.timeEnd('push for倒序')

console.time('扩展push')
const arr4 = []
arr4.push(...arr3)
// arr4.push.apply(arr4, arr3)
console.timeEnd('扩展push')

console.time('动态索引添加')
let arr4Length = arr4.length
const arr5 = []
for (let index = arr4.length - 1; index >= 0; index--) {
  arr5[index] = arr4[index]
}
console.timeEnd('动态索引添加')

console.log('length方法清空数组')
console.time('length')
arr1.length = 0
console.log(arr1)
console.timeEnd('length')

console.log('splice方法清空数组')
console.time('splice')
arr2.splice(0)
console.log(arr2)
console.timeEnd('splice')

// const arr = ['rabit', 'tank', 'dragon', 'evot']

// for (const [index, item] of arr.entries()) {
//   console.log(item, index)
// }
// Array.observe(arr, (e)=>{
//   console.log(e)
// })
